<?php
if (!class_exists('Cache')) {
	uses('Cache');
}
class GigaCache extends Cache 
{
	function &getInstance() {
		static $instance = array();
		if (!$instance) {
			$instance[0] = new GigaCache();
		}
		return $instance[0];
	}
	
	function getKey($key)
	{
		$prefix = cr('appCode');
		if(cr('webtest_id'))
		{
			$prefix .= '_webtest';
		}
		return $prefix.'_'.$key;
	}

	function write($key, $value, $config = null) 
	{
		$key = GigaCache::getKey($key);
		return parent::write($key, $value, $config);
	}

	function read($key, $config = null) 
	{
		$key = GigaCache::getKey($key);
		return parent::read($key, $config);
	}

	function delete($key, $config = null) 
	{
		$key = GigaCache::getKey($key);
		return parent::delete($key, $config);
	}
}

?>